<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Registration to Meteocal</title>
    </h:head>
    <h:body><p:layout fullPage="true">
        <p:layoutUnit position="west" size="900" collapsible="false" style="border: 0px">
            <h1 style="color: red">Register at</h1>
            <br/>
            <h:graphicImage value="/images/Simbolo_Meteocal.png" width="850"></h:graphicImage>
        </p:layoutUnit>
            <p:layoutUnit position="center" style="border: 0px">
                <br/><br/><br/><br/>
            <h:form>
            <p:panel header="Registration Form" style="border: 0px">
                
                <h:panelGrid columns="3" id="regGrid">
                    <h:outputLabel for="name">Name:</h:outputLabel>
                    <p:inputText id="name" value="#{registrationBean.user.name}">
                        <p:ajax update="namemsg"/>
                    </p:inputText>
                    <p:message id="namemsg" for="name" />
                    
                    <h:outputLabel for="email">Email:</h:outputLabel>
                    <p:inputText id="email" value="#{registrationBean.user.email}" >
                        <p:ajax update="emailmsg"/>
                    </p:inputText>
                    <p:message id="emailmsg" for="email" />
                    
                    <h:outputLabel for="password">Password:</h:outputLabel>
                    <p:password id="password" value="#{registrationBean.user.password}"
                                feedback="true" match="pwd2" label="Password"/>
                    <p:message for="password" />

                    <h:outputLabel for="pwd2">Confirm Password:</h:outputLabel>
                    <p:password id="pwd2" label="Confirm Password"/>
                    <h:selectOneRadio id="calendartype" layout="pageDirection" required="true"> 
                                <f:selectItem id="item0" itemLabel="Public Calendar" itemValue="1" />
                                <f:selectItem id="item1" itemLabel="Private calendar" itemValue="2" />
                            </h:selectOneRadio>
                </h:panelGrid>
                <p:commandButton value="Register" update="regGrid"
                                 action="#{registrationBean.register()}" />
            </p:panel>
        </h:form>       
        </p:layoutUnit>
        <p:layoutUnit position="south" size="100" style="border: 0px">
                <p>
                    You are already registered? 
                    <h:link outcome="index" value="You can login here" />
                </p>
                <p>
                    <a href="http://openweathermap.org/api" style="color: blue">Weather forecast API site</a>
                </p> 
        </p:layoutUnit>
        </p:layout>
        
    </h:body>
</html>

